package com.wish.blessingroad.quartz;

import com.wish.blessingroad.common.Constant;
import com.wish.blessingroad.service.IBlessingService;
import org.apache.http.client.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import redis.clients.jedis.params.SetParams;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * 祝福表过期处理
 *
 * @author DongHaocheng
 * @date 2019/3/11
 */
@EnableScheduling
@Component
public class BlessingQuartz {
    private final static Logger LOG = LoggerFactory.getLogger(BlessingQuartz.class);
    @Autowired
    private IBlessingService blessingServiceImpl;

    //@Scheduled(cron = "*/30 * * * * ?")
    @Scheduled(cron = "0 0 5 * * ?")
    public void delAllow() {
        LOG.info("BlessingQuartz delBlessingQuartz ...");
        blessingServiceImpl.delBlessingEndTime(
                DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"),Constant.StaticBlessing.STATUS_BLESSING_INTEND);
    }

}
